<?php

namespace App\Http\Middleware;

use Closure;

class Check
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
		if($request->session()->has('user_id')){
            return $next($request);
        }else{
            //return view('blog.error', ['msg'=>'You are not logged in']);
            //die('You are not logged in');
            return redirect()->action('BlogController@login');
        };
    }
}
